<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <div id="app">
            {{count}}
            <button @click="add">增加</button>
        </div>
        <script type="module">
            import { 
                createApp,
                ref // 实现将基础数据类型转化为响应式数据，本质还是 reactive，ref(xx) —— reactive({value: xx})
            } from "./node_modules/vue/dist/vue.esm-browser.js";

            function addCount() {
                const count = ref(0);
                function add() {
                    count.value++;
                }
                return {
                    count,
                    add,
                };
            }

            createApp({
                setup() {
                    return {
                        ...addCount(),
                    };
                },
            }).mount("#app");
        </script>
    </body>
</html>
